package com.hp.gxw.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hp.gxw.constant.CountEnum;
import com.hp.gxw.entity.CostElements;
import com.hp.gxw.entity.CostElementsPrice;
import com.hp.gxw.mapper.CostElementsMapper;
import com.hp.gxw.mapper.CostElementsPriceMapper;
import com.hp.gxw.service.ICostElementsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author huangping
 * @since 2024-01-04
 */
@Service
public class CostElementsServiceImpl extends ServiceImpl<CostElementsMapper, CostElements> implements ICostElementsService {

    @Resource
    private CostElementsPriceMapper costElementsPriceMapper;

    @Override
    public List<CostElements> elementPriceInfo(String happenMonth) {
        return costElementsPriceMapper.getElementsPrice(happenMonth);
    }

    /**
     * 直接人工法
     * @param month
     * @return
     */
    @Override
    public List<CostElementsPrice> directLaborInfo(String month) {
        return costElementsPriceMapper.generateElementPrice(CountEnum.direct_labor.getCode(), month);
    }

    /**
     * 设备功率法
     * @param month
     * @return
     */
    @Override
    public List<CostElementsPrice> equipmentPowerInfo(String month) {
        return costElementsPriceMapper.generateElementPrice(CountEnum.equipment_power.getCode(), month);
    }

    @Override
    public List<CostElementsPrice> indirectEquipmentInfo(String month) {
        return costElementsPriceMapper.generateElementPrice(CountEnum.indirect_equipment.getCode(), month);
    }

    @Override
    public List<CostElementsPrice> indirectWorkhoursInfo(String month) {
        return costElementsPriceMapper.generateElementPrice(CountEnum.indirect_workhours.getCode(), month);
    }

    @Override
    public List<CostElementsPrice> indirectManagerInfo(String month) {
        return costElementsPriceMapper.generateElementPrice(CountEnum.indirect_manager.getCode(), month);
    }
}
